// Domien Nowicki
#include "QtRobotTurnAnimation.h"

QtRobotTurnAnimation::QtRobotTurnAnimation(): robot(0)
{
}

QtRobotTurnAnimation::QtRobotTurnAnimation(const QtRobotTurnAnimation& rhs): QtAnimationCommand(rhs), robot(rhs.robot), turnDirection(rhs.turnDirection)
{
}

QtRobotTurnAnimation::~QtRobotTurnAnimation()
{
}

void QtRobotTurnAnimation::SetRobot(QtRobotSprite* receiver, const Direction& direction)
{
	robot = receiver;
	turnDirection = direction;
}

void QtRobotTurnAnimation::Execute()
{
	if (robot)
	{
		switch(turnDirection.Type())
		{
			case Direction::WEST:
				robot->TurnLeft();
			break;
			case Direction::EAST:
				robot->TurnRight();
			break;
		}
	}
}

QtAnimationCommand* QtRobotTurnAnimation::Clone() const
{
	return new QtRobotTurnAnimation(*this);
}
